import sys
import pandas as pd
import sqlite3




def save_csv_to_db(file_name,sep=None):

    if sep==None:
        sep=','
    else:
        sep=sep

    conn=sqlite3.connect('../db.sqlite3')

    df=pd.read_csv(file_name,sep=sep)

    df.to_sql(file_name.replace('.','_'),conn)

if __name__ == '__main__':

    try:
        save_csv_to_db(sys.argv[1],sys.argv[2])
    except IndexError:
        save_csv_to_db(sys.argv[1])